import { createSSRApp } from "vue";
import App from "./App.vue";
import TnIcon from "@tuniao/tnui-vue3-uniapp/components/icon/src/icon.vue";
import * as Pinia from "pinia";
import { createPersistedState } from "pinia-plugin-persistedstate";
import * as storage from "@/utils/storage";

export function createApp() {
  const app = createSSRApp(App);

  app.component("TnIcon", TnIcon);

  const store = Pinia.createPinia();
  store.use(
    createPersistedState({
      storage: storage,
    })
  );

  app.use(store);

  return {
    app,
    store,
  };
}
